﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using DAL;
using System.Web.Configuration;

public partial class Plublic_Logout : System.Web.UI.Page
{
    String StrConn = WebConfigurationManager.ConnectionStrings["conn"].ConnectionString.ToString();
    LoginHistoryHandler objLoginHistoryHandler = new LoginHistoryHandler();

    protected void Page_Load(object sender, EventArgs e)
    {
        LoginHistory objLoginHistory = new LoginHistory();

        objLoginHistory.UserID = Convert.ToInt32(Session["UserID"]);
        objLoginHistory.LoginDate = Session["LoginDate"].ToString(); 
        objLoginHistory.LogoutDate = DateTime.Now.ToString();
        objLoginHistory.Descriptions = "";
        objLoginHistory.SessionId = Session["SessionId"].ToString();

        objLoginHistoryHandler.UpdateLoginHistory(objLoginHistory, StrConn);

        Session.RemoveAll();
        Response.Redirect("Default.aspx");
    }
}